//
//  SubjectThreeLightVoiceViewController.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/24.
//

#import "SubjectThreeLightVoiceViewController.h"
#import "SubjectThreeLightVoiceCell.h"
#import "SubjectThreeLightVoiceHeadV.h"
#import "SubjectThreeLightSetViewController.h"
#import "EditLightCombinationsViewController.h"

@interface SubjectThreeLightVoiceViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    SubjectThreeLightVoiceHeadV *_SubjectThreeLightVoiceHeadV;
    SubjectThreeLightVoiceCell *Cell;
    UITableView *_Tabview;
}
@end

@implementation SubjectThreeLightVoiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    //隐藏头部view
    self.navigationController.navigationBar.hidden = YES;
    NavigationHeadView *navgationheadv = [[NavigationHeadView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, SafeAreaTopHight)];
    navgationheadv.titlelabel.text = @"科三灯光语音";
    navgationheadv.titlelabel.textColor = [UIColor blackColor];
    navgationheadv.backbtn.hidden = NO;
    navgationheadv.rightbtn.hidden = NO;
    [navgationheadv.rightbtn setTitle:@"设置" forState:0];
    [navgationheadv.rightbtn setTitleColor:rgba(22, 120, 255, 1) forState:0];
    [navgationheadv.rightbtn addTarget:self action:@selector(setBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [navgationheadv.backbtn addTarget:self action:@selector(returnback) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:navgationheadv];
    
    
    
    _Tabview  = [[UITableView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHight, APPwidth, APPheight)];
    _Tabview.delegate = self;
    _Tabview.dataSource = self;
    _Tabview.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:_Tabview];
    
    
    _SubjectThreeLightVoiceHeadV = [[SubjectThreeLightVoiceHeadV alloc]initWithFrame:CGRectMake(0, 0, APPwidth, 200)];
    _Tabview.tableHeaderView = _SubjectThreeLightVoiceHeadV;
    [_SubjectThreeLightVoiceHeadV.zuhezhilingBtn addTarget:self action:@selector(zuhezhilingBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *bottomBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, APPheight-SafeAreaBottomHeight-50, APPwidth, 50)];
    [bottomBtn setTitle:@"随机播放5条单项指令" forState:0];
    bottomBtn.contentHorizontalAlignment = 1;
    [bottomBtn setBackgroundColor:[UIColor whiteColor]];
    [bottomBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
    bottomBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0);
    bottomBtn.layer.shadowPath = [UIBezierPath bezierPathWithRect:bottomBtn.bounds].CGPath;
    bottomBtn.titleLabel.font = [UIFont boldSystemFontOfSize:14];
    bottomBtn.layer.shadowColor = [UIColor grayColor].CGColor;
    bottomBtn.layer.shadowRadius = 1;
    bottomBtn.layer.shadowOpacity = 0.5;
    //    bmBtn.imageEdgeInsets = UIEdgeInsetsMake(10, 13, 7, 62);
    //    [bmBtn.imageView setContentMode:UIViewContentModeScaleAspectFit];
    //    bmBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 13, 0, 0);
    [self.view addSubview:bottomBtn];
    
    UIButton *bfBtn = [[UIButton alloc]initWithFrame:CGRectMake(bottomBtn.width-100,15, 60, 30)];
    [bfBtn setTitle:@"播放" forState:0];
    bfBtn.contentHorizontalAlignment = 0;
    [bfBtn setBackgroundColor:rgba(22, 120, 255, 1)];
    [bfBtn setTitleColor:[UIColor whiteColor] forState:0];
    bfBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    bfBtn.layer.cornerRadius = 15;
    [bottomBtn addSubview:bfBtn];
    
}
#pragma mark - UITableView DataSource

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return 80;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 6;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString * str = @"cell";
    
    Cell  = [tableView dequeueReusableCellWithIdentifier:str];
    if (Cell == nil) {
        
        Cell = [[SubjectThreeLightVoiceCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier:str];
    }
    
//    Cell.nameLab.text = @"学员:小芒果";
    
    Cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return Cell;
}
-(void)zuhezhilingBtnClick{
    EditLightCombinationsViewController *vc = [[EditLightCombinationsViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - 设置
-(void)setBtnClick{
    SubjectThreeLightSetViewController *vc = [[SubjectThreeLightSetViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)returnback{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark -视图即将出现
-(void)viewWillAppear:(BOOL)animated{
        
    ((TabbarController *)self.tabBarController).tabBarView.hidden = YES;
    
}




@end
